class Demo <T> {
    public Object[] objects = new Object[10];
    public T getPos(int pos) {
        return (T) objects[pos];
    }
    public void setVal(int pos,T val) {
        objects[pos] = val;
    }
}
public class Test {
    public static void main(String[] args) {
        Demo<Integer> demo = new Demo<>();
        demo.setVal(1,2);
        Integer a = demo.getPos(1);
        System.out.println(a);
    }
}
